<?php

require_once('./db.php');

$id = $_POST['id'];

$query = "SELECT * FROM `categories` WHERE `parent_id`=$id";
$result = mysql_query($query) or die(mysql_error());

while ($ans = mysql_fetch_assoc($result)) {
  $catAray[] = $ans;
}

echo json_encode($catAray);
